package com.cakin.javademo;

/**
 * @ClassName: StringTest2
 * @Description: 测试格式化
 * @Date: 2020/6/15
 * @Author: cakin
 */
public class StringTest2 {
    /**
     * 功能描述：
     *
     * @author cakin
     * @date 2020/6/15
     * @param 
     * @return 
     * @description:
     * System.out.printf
     * String.format
     */
    public static void main(String[] args) {
        // printf
        float floatVar =0.0f;
        int intVar = 5;
        String stringVar ="hello";

        System.out.printf("浮点型变量的值为 " +
                "%f, 整型变量的值为 " +
                " %d, 字符串变量的值为 " +
                "is %s", floatVar, intVar, stringVar);
        // format
        String format = String.format("浮点型变量的值为 " +
                "%f, 整型变量的值为 " +
                " %d, 字符串变量的值为 " +
                "is %s", floatVar, intVar, stringVar);
        System.out.println();
        System.out.println(format);


    }
}
